﻿using System;
namespace Producers.Ehma10000000.Xtee.Riik.Ee.Producer.Ehma10000000 {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="ehmaParinguPaev", Namespace="http://producers.ehma-10000000.xtee.riik.ee/producer/ehma-10000000", Target=typeof(EhmaParinguPaev))]
    public class EhmaParinguPaevSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IEhmaParinguPaev clazz;
        
        public EhmaParinguPaevSerializer(IEhmaParinguPaev clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("casinobday");
            if (clazz.Casinobday!=null) {
                Writer.WriteTypeAttribute("http://producers.ehma-10000000.xtee.riik.ee/producer/ehma-10000000", ">>ehmaParinguPaev>casinobday");
                Writer.WriteString(clazz.Casinobday.ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Casinobday");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="casinobday") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>ehmaParinguPaev>casinobday");
                }
                clazz.Casinobday = new EhmaParinguPaev.CasinobdayType(Reader.ReadElementString("casinobday"));
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>ehmaParinguPaev>casinobday", Reader.LocalName);
            }
        }
    }
}
